All Functions of Week 1

class

{base}

Retrieve class of an R object

ifelse

{base}

Return a or b depending on the value of test

setwd

{base}

Set Working Directory

ls.str

{utils}

Similarly to ls, with a print() method that calls str() on each object

sd

{stats}

Get standard deviation of a vector

cbind

{base}

Combine R objects by columns

c

{base}

Combine values/vectors into a vector

head

{utils}

Show first 5 rows of a data frame

library

{base}

Load an R package

nrow

{base}

Get number of rows of a data frame

ncol

{base}

Get number of columns of a data frame

str

{utils}

Get the structure of an R object

ls

{base}

Return a vector of character strings giving the names of the objects in the specified environment

rbind

{base}

Combine R objects by rows

read.spss

{foreign}

Read a .sav file (SPSS data)

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

dim

{base}

Get dimensions of a data frame

View

{base}

View a data frame

attach

{base}

Attach Set of R Objects to Search Path

mean

{base}

Get mean of a vector

plot

{graphics}

Generic function from base R to produce a plot

names

{base}

Retrieve names of a list/vector

The end!